import request from '@/utils/request'

// rule: 规则    role: 角色
export function getRoles(params) {
  return request({
    url: '/sys/role',
    method: 'GET',
    params
  })
}

export function delRoleById(id) {
  return request({
    url: '/sys/role/' + id,
    method: 'DELETE'
  })
}

export function addRole(data) {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}

export function updateRole(data) {
  return request({
    url: '/sys/role/' + data.id,
    method: 'PUT',
    data
  })
}

export function getRoleDetailById(id) {
  return request({
    url: '/sys/role/' + id,
    method: 'GET'
  })
}

export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'PUT',
    data
  })
}
